﻿using System.Threading.Tasks;
using Abp.UI;
using Magicodes.WeChat.SDK;
using Magicodes.WeChat.SDK.Apis.Menu;

namespace Magicodes.WeChat.Application.Menu
{
    public class WeChatMenuAppService : AppServiceBase, IWeChatMenuAppService
    {
        public Task CreateOrUpdateMenus(MenuInfo input)
        {
            var result = WeChatApisContext.Current.MenuApi.Create(input);
            if (result.IsSuccess())
                return Task.FromResult(true);
            throw new UserFriendlyException(result.GetFriendlyMessage());
        }
    }
}